<script src="<?cs var:config.docpath?>resource/js/dmt.addplugin.js?v=110"></script>
<script language="javascript" type="text/javascript">


$(document).ready(function(){
    var machine_plugins = $.parseJSON('<?cs var:config.machine_plugins ?>');
    if(machine_plugins.count > 0) {
        var uhtml = '';
        var lt = machine_plugins.plugins;
        for(var i=0; i < lt.length; ++i) {
            uhtml += "<tr>";
            uhtml += "<td>" + lt[i].id + "</td>";
            uhtml += "<td>" + lt[i].show_name + "</td>";
            uhtml += "<td>" + lt[i].name + "</td>";
			if(lt[i].run_os == 'All_os')
				uhtml += "<td>跨平台</td>";
			else
				uhtml += "<td>" + lt[i].run_os + "</td>";
			uhtml += "<td>" + lt[i].language + "</td>";
			uhtml += "<td>" + lt[i].auth + "</td>";
            uhtml += "<td>" + lt[i].last_version + "</td>";
		    uhtml += "<td class='detail'><a href='" + lt[i].desc_url + "' target='_blank'>详情</a></td>";
            if(lt[i].installed == 1)
                uhtml += "<td>已部署</td>";
            else {
                uhtml += "<td class='detail'><a href='#' onclick='return dmapAddPlugin(\"<?cs var:config.cgipath ?>\", ";
                uhtml += "<?cs var:config.machine_id ?>, "+ lt[i].id + ");'>一键部署</a></td>";
            }
        }
        $('#dmap_machine_plugin_<?cs var:config.machine_id ?>').html(uhtml);
    }

    <?cs if:config.run_time > 0 ?>
        $('#dmap_mach_run_<?cs var:config.machine_id ?>').html(dmtGetHumanTime(<?cs var:config.run_time ?>));
    <?cs else ?>
        $('#dmap_mach_run_<?cs var:config.machine_id ?>').html("<font color='red'>已停止</font></td>");
    <?cs /if ?>
});

</script>

<div class="pageContent statusMachine" layoutH='0'>
	<div class="pageFormContent">
        <div>
            <font class='note-text'>提示：</font>
            <br />
            <ul>
                <li class='note-text' style='margin-left:30px'>插件一键部署需要机器上安装监控 agent，且agent 为启动状态。</li>
                <li class='note-text' style='margin-left:30px'>如果系统信息获取不正确或者一键部署失败，请检查机器上是否支持 wget/awk/grep/sed/tar/strings 等命令。</li>
                <li class='note-text' style='margin-left:30px'>插件一键部署过程可能<font color='red'>重启相关服务</font>，如：apache/mysql 等，请熟悉过程后再在您的生产环境操作。</li>
                <li class='note-text' style='margin-left:30px'>插件部署过程会在 agent 的 plugin_install_log 目录下生成部署日志，您可以通过该日志了解插件部署的相关流程细节。</li>
            </ul>
        </div>
        <br />
 
        <h3>待部署机器信息</h3>
		<table class='list' width='100%'> 
            <thead>
                <tr>
                    <th align='left' >机器ID</th>
                    <th align='left' >机器名称</th>
                    <th align='left' >机器IP</th>
                    <th align='left' >系统平台</th>
                    <th align='left' >体系结构</th>
                    <th align='left' >libc版本</th>
                    <th align='left' >libcpp版本</th>
                    <th align='left' >agent 已运行</th>
                    <th align='left' >最近心跳时间</th>
                </tr>
            </thead>
            <tbody>
			    <tr>
				    <td><?cs var:config.machine_id ?></td>
				    <td><?cs var:config.machine_name ?></td>
				    <td><?cs var:config.machine_ip ?></td>
				    <td><?cs var:config.run_os ?></td>
				    <td><?cs var:config.os_arc ?></td>
				    <td><?cs var:config.libc_ver ?></td>
				    <td><?cs var:config.libcpp_ver ?></td>
                    <td id='dmap_mach_run_<?cs var:config.machine_id ?>'></td>
				    <td><?cs var:config.last_hello_time ?></td>
			    </tr>
            </tbody>
        </table>
        <br />

        <h3>已部署/可部署插件</h3>
        <table class='list' width='100%'>
            <thead>
                <tr>
                    <th align='left' >插件ID</th>
                    <th align='left' >插件显示名</th>
                    <th align='left' >插件部署名</th>
                    <th align='left' >运行平台</th>
                    <th align='left' >开发语言</th>
                    <th align='left' >插件作者</th>
                    <th align='left' >当前版本</th>
                    <th align='left' >插件详情</th>
                    <th align='left' >部署</th>
                </tr>
            </thead>
            <tbody id='dmap_machine_plugin_<?cs var:config.machine_id ?>'>
            </tbody>
	    </table>
	</div>
</div>


